package com.awesome.javademo.abstracts;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

import com.awesome.common.util.log.ShowLogUtil;
import com.awesome.javademo.R;

public class AbstractActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_abstract);

//        People people1 = new People();
        People people2 = new Employee();
        Employee employee1 = new Employee();
        // 报异常，创建时必须是子类对象
//        Employee employee2 = (Employee) people1;
        Employee employee3 = (Employee) people2;
        people2.eat();
        employee1.eat();
        employee1.work();
//        employee2.eat();
//        employee2.work();
        employee3.eat();
        employee3.work();
    }
}